import java.util.ArrayList;
public class Node {

	public ArrayList<Node> cList; //list of children.
	public Node parent;
	public String str;
	public Node suffixLink;
	public String totalString;
	public int insertNumber;
	
	public boolean marked; //added for tandem
	public ArrayList<Integer> LL;
	
	public Node(String input, Node parent)
	{
		marked = false;
		str = input;
		cList = new ArrayList<Node>();
		suffixLink = null;
		this.parent = parent;
		LL = new ArrayList<Integer>();
	}
	
	public void setInsertNumber(int n)
	{
		insertNumber = n;
	}
	
	public int getInsertNumber()
	{
		return this.insertNumber;
	}
	public String getStr()
	{
		return this.str;
	}
	
	public void setTotalString(String s)
	{
		this.totalString = s;
	}
	
	public String getTotalString()
	{
		return this.totalString;
	}
	
	public void setStr(String s)
	{
		this.str = s;
	}
	
	public void deleteChild(int n)
	{
		cList.remove(n);
	}
	
	public void deleteChild(Node n) 
	{		
		for(int i = 0; i<this.cList.size();i++)
		{
			if(n.getStr().charAt(0) == this.cList.get(i).getStr().charAt(0))
			{
				this.cList.remove(i);
				return;
			}
		}
		System.out.println("this is baad");
		return;
	}
	
	public void addChild(Node n)
	{
		this.cList.add(n);
		ST.nodeList.add(n);
	}
	
	public void addChild(String s)
	{
		Node child = new Node(s, this);
		child.setTotalString(s);
		this.cList.add(child);
		ST.nodeList.add(child); 
	}
	
	public Node getParent()
	{
		return this.parent;
	}
	
	public void setParent(Node n)
	{
		this.parent = n;
	}
	
	public void setSuffixLink(Node n)
	{
		this.suffixLink = n;
	}
	
	public Node getSuffixLink()
	{
		return this.suffixLink;
	}
	
	public int amountOfChildren()
	{
		return this.cList.size();
	}
}